// 引入
import Request from '@/libs/request'
import qs from 'qs'
import axios from 'axios'


// 使用枚举包含所有的path
enum Api {
  // 查询参数列表
  selectParamList = '/platFormSubUser/select/param',
  // 查询设备列表
  selectDevList = '/platFormSubUser/select/devList',
  // 提交快捷配置数据
  addQuickStandRange = '/platFormSubUser/add/quickStandRange'
}


// 查询参数列表的Api
export const selectParamListApi = (data: { platFormSubUserId: string | number | null }) => {
  return Request.post(Api.selectParamList, qs.stringify(data))
}

// 查询设备列表的Api
export const selectDevListApi = (data: { platFormSubUserId: string | number | null }) => {
  return Request.post(Api.selectDevList, qs.stringify(data))
}

// 提交快捷配置数据的Api
export const submitQuickStandRangeApi = (data: { devIds: string, devStandRangeList: { paramCode: string, devSRDesc: string, standRange: string }[] }) => {
  // 因全局字符串请求头
  // return Request.post(Api.addQuickStandRange, data, {
  //   headers: {
  //     'Content-Type': 'application/json'
  //   }
  // })
  return axios({
    method: 'post',
    url: 'http://192.168.0.161:11006/platFormSubUser/add/quickStandRange',
    data: data,
    headers: {
      'Content-Type': 'application/json',
      'accessToken': localStorage.getItem('token'),
      'platFormSubUserId': localStorage.getItem('platFormSubUserId')
    }
  })

}